package com.bitcola.security.statistics.feign;

import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.bitcola.entity.ColaMeBalanceWithdrawin;
import com.bitcola.entity.ColaUserEntity;
import com.bitcola.entity.ColaUserKyc;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/**
 *  @author wx
 * @create 2018-11-08 11:53
 **/
@FeignClient(value = "dataservice")
@Service
public interface IDataServiceFeign {

    @RequestMapping(value = "user/info",method = RequestMethod.GET)
    @Cached(cacheType = CacheType.LOCAL,expire = 60)
     ColaUserEntity info(@RequestParam("userId") String userId);
    @RequestMapping(value = "user/infoByInviterCode",method = RequestMethod.GET)
     ColaUserEntity infoByInviterCode(@RequestParam("inviterCode") String inviterCode);

    @RequestMapping(value = "systemBalance/transformBalance",method = RequestMethod.GET)
     boolean transformBalance(@RequestParam("fromUser") String fromUser, @RequestParam("toUser") String toUser,
                                    @RequestParam("coinCode")String coinCode,@RequestParam("fromFrozen")boolean fromFrozen,
                                    @RequestParam("toFrozen")boolean toFrozen,@RequestParam("number")BigDecimal number,
                                    @RequestParam("type")String type, @RequestParam("description")String description);

    @RequestMapping(value = "user/getUserKycInfo",method = RequestMethod.GET)
     ColaUserKyc getUserKycInfo(@RequestParam("userId")String userId);
    @RequestMapping(value = "config/getConfig",method = RequestMethod.GET)
    @Cached(expire = 30,cacheType = CacheType.LOCAL)
     String getConfig(@RequestParam("config") String config);

    @Cached(expire = 10,cacheType = CacheType.LOCAL)
    @RequestMapping(value = "user/findUserInvitor",method = RequestMethod.GET)
     ColaUserEntity findUserInvitor(@RequestParam("userId")String userID);
    @RequestMapping(value = "balance/changeUserBalance",method = RequestMethod.POST)
    int  changeUserBalance(@RequestParam("userID")String userID, @RequestParam("coinCode")String coinCode, @RequestParam("balance")BigDecimal balance,
                           @RequestParam("balanceFrozen")BigDecimal balanceFrozen,@RequestParam("prizeBalanceFrozen")BigDecimal prizeBalanceFrozen,@RequestParam("applyAmount")BigDecimal applyAmount,
                           @RequestParam("prizeBalanceReleased")BigDecimal prizeBalanceReleased);


    @RequestMapping(value = "chain/getById",method = RequestMethod.GET)
     ColaMeBalanceWithdrawin getById(@RequestParam("id")String id);




}
